<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class LiveController extends Controller
{
    //直播播放
    public function play($id){
    	//通过下面的几个拉流地址可以发现，其地址前面都是一样的，区别在于流名称
    	//rtmp://pili-live-rtmp.28sjw.com/education-zet/qwertyu
    	//rtmp://pili-live-rtmp.28sjw.com/education-zet/testGlucky666
    	//rtmp://pili-live-rtmp.28sjw.com/education-zet/testGlucky5157
    	$url = 'rtmp://pili-live-rtmp.28sjw.com/education-zet/';
    	//根据当前传递过来的直播课程live表的id，获取流名称
    	$data = \App\Admin\Live::with('rel_stream') -> where('id',$id) -> first();
    	$url .= $data -> rel_stream -> stream_name;
    	//展示视图，并且携带参数
    	return view('home.live.play',['url' => $url,'title' => $data -> live_name]);
    }
}
